//
//  Person.m
//  LessonUI_19_数据持久化
//
//  Created by 王佩 on 15/9/9.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "Person.h"

@implementation Person
//  实现协议中的两个方法
#pragma mark---进行编码
- (void)encodeWithCoder:(NSCoder *)coder
{
    [coder encodeObject:self.name forKey:@"name"];
    [coder encodeInteger:self.age forKey:@"age"];
    [coder encodeObject:self.dog forKey:@"dog"];
}

#pragma mark----进行反编码
- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
      self.name = [aDecoder decodeObjectForKey:@"name"];
      self.age = [aDecoder decodeIntegerForKey:@"age"];
        self.dog = [aDecoder decodeObjectForKey:@"dog"];
    }
    return self;
}






@end
